<?php

/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
 */

// 账户登录
Route::post('account/login', 'AccountController@login');

// 商品列表
Route::get('goods', 'GoodsController@index');

// 新闻列表
Route::get('news', 'NewsController@index');

// 订单-支付回调接口
Route::get('callback/payments/{trade_type}', 'PaymentsController@callback');

// 测试
Route::get('tests/user', 'TestsController@user');

// facebook登录
Route::get('oauth/facebook', 'OauthController@facebook');

// facebook回调
Route::get('oauth/callback/facebook', 'OauthController@callback');

Route::group(['middleware' => 'auth:api'], function () {

	// 账户信息
	Route::get('account', 'AccountController@show');

	// 更新账号
	Route::post('account', 'AccountController@update');

	// 用户排行榜（联赛）
	Route::get('score-board/tournament/{tournament}', 'ScoreboardController@tournament');

	// 用户排行榜（全球）
	Route::get('score-board/global', 'ScoreboardController@global');

	// 获取最近游戏记录
	Route::get('played-games', 'GamesController@index');

	// 获取积分赛列表
	Route::get('integrals', 'IntegralsController@index');

	// 进入积分赛
	Route::post('integrals/{integral}', 'IntegralsController@play');

	// 获取正在进行的积分赛
	Route::get('integrals/check', 'IntegralsController@check');

// 	// 创建商品订单
// 	Route::post('orders', 'OrdersController@create');

	// 获取联赛列表
	Route::get('tournaments', 'TournamentsController@index');

	// 进入联赛
	Route::post('tournaments/{tournament}', 'TournamentsController@play');
});